package com.ruoyi.wechat.controller;

import com.ruoyi.wechat.domain.AppUserCoupon;
import com.ruoyi.wechat.domain.vo.AjaxResult;
import com.ruoyi.wechat.service.IAppUserCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.ruoyi.wechat.domain.vo.AjaxResult.success;

/**
 * 用户优惠券Controller
 *
 * @author YInHeng
 * @date 2024-05-07
 */
@RestController
@RequestMapping("/userCoupon")
public class AppUserCouponController {
    @Autowired
    private IAppUserCouponService appUserCouponService;

    /**
     * 查询用户优惠券列表
     */
    @GetMapping("/list")
    public AjaxResult list(AppUserCoupon appUserCoupon) {
        List<AppUserCoupon> list = appUserCouponService.selectAppUserCouponList(appUserCoupon);
        return success(list);
    }

    /**
     * 获取用户优惠券详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(appUserCouponService.selectAppUserCouponById(id));
    }

}
